<!DOCTYPE html>
<html>
<head>
    <title>extend函数测试</title>
    <meta charset="utf-8"/>
    <script src="../../../js/jquery-1.10.1.min.js"></script>
    <script>
       $().ready(function(){
           $(document).on("click", "#testBtn", function(){

               var settings = { validate: false, limit: 5, name: "foo" };
               var options = { validate: true, name: "bar" };
               jQuery.extend(settings, options);
               alert("options:" + options);
               alert("settings:" + settings);

               var programObj = [{"programId": 111, "size": 2, files: [{"trimIn": 0, "trimOut": 200, "path": "http://100.0.0.10"}, {"trimIn": 100, "trimOut": 150, "path": "http://100.0.0.10"}]}];
               var tempObj = [];
               var tempObj = jQuery.extend(true,{}, programObj);
               //$.extend(tempObj, programObj);
               //数组中含有对象，不能复制成功
               programObj.size = 10000;
               tempObj.size = 20000;
               alert(programObj[0].files[0].trimIn);
               programObj[0].files[0].trimIn = 500;
               alert(programObj[0].files[1].trimIn);
               alert(tempObj[0].files[0].trimIn);

           });

       });
    </script>
</head>
<body>
    <p>extend函数测试
        <input id="testBtn" type="button" value="Test"/>
    </p>
</body>
</html>